import request from "@/request/request";
import qs from "qs";

// 精品推荐数据接口
/* export const JingPinAPI = function () {
  return request.get("/products/recommend");
}; */

// ES6精品数据推荐写法
export const JingPinAPI = () => request.get("/products/recommend");

// 请求热门兑换的数据
export const ReMenAPI = () => request.get("/products/hot");

// 获取用户信息接口
export const UserProfilesAPI = () => request.get("/shop/userProfiles");

// 请求详情页的数据
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`);

// 加入到购物车
export const AddToCartAPI = (params) =>
  request.post("/shop/carts/add", qs.stringify(params));

// 请求全部商品
export const GoodsSearchAPI = (params) => request.get("/products", { params });

// 获取购物车数据
export const CartDataAPI = () => request.get('/shop/carts');

// 请求删除购物车商品
export const CartDelAPI = (params) => request.delete(`/shop/carts?productIds=${params.id}`);

// 发送验证码接口
export const SendSMSAPI = (params) =>
  request.post("/sendSMS", qs.stringify(params));

// 手机验证码登录请求接口
export const PhoneLoginAPI = (params) => {
  return request.post("/phoneRegin", qs.stringify(params));
};

// 微信扫码登录请求接口
export const WeixinLoginAPI = (params) =>
  request.post("/wechatUsers/PCLogin", qs.stringify(params));

// 手机绑定微信接口
export const BindPhoneAPI = (params) =>
  request.post("/wechatUsers/binding", qs.stringify(params));
